package com.hc.conferencecheck;

import com.github.pagehelper.PageHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.Properties;

//扫描过滤器
@ServletComponentScan
//开启事务
@EnableTransactionManagement
@SpringBootApplication
//public class ConferenceCheckApplication extends SpringBootServletInitializer {
//    //打包需要继承的类：extends SpringBootServletInitializer，需要重写的方法：下面的方法
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(ConferenceCheckApplication.class);
//    }
//
//    public static void main(String[] args) {
//        SpringApplication.run(ConferenceCheckApplication.class, args);
//    }
//
//    //配置mybatis的分页插件pageHelper
//    @Bean
//    public PageHelper pageHelper() {
//        PageHelper pageHelper = new PageHelper();
//        Properties properties = new Properties();
//        properties.setProperty("offsetAsPageNum", "true");
//        properties.setProperty("rowBoundsWithCount", "true");
//        properties.setProperty("reasonable", "true");
//        //配置mysql数据库的方言
//        properties.setProperty("dialect", "mysql");
//        pageHelper.setProperties(properties);
//        return pageHelper;
//    }
//}
public class ConferenceCheckApplication {
    //打包需要继承的类：extends SpringBootServletInitializer，需要重写的方法：下面的方法

    public static void main(String[] args) {
        SpringApplication.run(ConferenceCheckApplication.class, args);
    }

    //配置mybatis的分页插件pageHelper
    @Bean
    public PageHelper pageHelper() {
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum", "true");
        properties.setProperty("rowBoundsWithCount", "true");
        properties.setProperty("reasonable", "true");
        //配置mysql数据库的方言
        properties.setProperty("dialect", "mysql");
        pageHelper.setProperties(properties);
        return pageHelper;
    }
}
